﻿
#pragma once

#include <assert.h>

// 有现成的assert 就用现成的，没有就自定义一个简单的assert, 条件失败时原地死循环

namespace ioxx {

#ifndef _IOXX_ASSERT_WITH_MESSAGE
    #ifndef NDEBUG
        #ifdef assert

            #define _IOXX_ASSERT_WITH_MESSAGE(condition, fail_message) assert(condition)
    
#elif defined(assert_param)
            #define _IOXX_ASSERT_WITH_MESSAGE(condition, fail_message) assert_param(condition)
        #else
            #define _IOXX_ASSERT_WITH_MESSAGE(condition, fail_message) \
                do {                                              \
                } while (!(condition))
        #endif
    #else
        #define _IOXX_ASSERT_WITH_MESSAGE(condition, fail_message)
    #endif
#endif

}  // namespace ioxx